//
//-
// ==========================================================================
// Copyright (C) 1995 - 2006 Autodesk, Inc. and/or its licensors.  All 
// rights reserved.
//
// The coded instructions, statements, computer programs, and/or related 
// material (collectively the "Data") in these files contain unpublished 
// information proprietary to Autodesk, Inc. ("Autodesk") and/or its 
// licensors, which is protected by U.S. and Canadian federal copyright 
// law and by international treaties.
//
// The Data is provided for use exclusively by You. You have the right 
// to use, modify, and incorporate this Data into other products for 
// purposes authorized by the Autodesk software license agreement, 
// without fee.
//
// The copyright notices in the Software and this entire statement, 
// including the above license grant, this restriction and the 
// following disclaimer, must be included in all copies of the 
// Software, in whole or in part, and all derivative works of 
// the Software, unless such copies or derivative works are solely 
// in the form of machine-executable object code generated by a 
// source language processor.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND. 
// AUTODESK DOES NOT MAKE AND HEREBY DISCLAIMS ANY EXPRESS OR IMPLIED 
// WARRANTIES INCLUDING, BUT NOT LIMITED TO, THE WARRANTIES OF 
// NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR 
// PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE, OR 
// TRADE PRACTICE. IN NO EVENT WILL AUTODESK AND/OR ITS LICENSORS 
// BE LIABLE FOR ANY LOST REVENUES, DATA, OR PROFITS, OR SPECIAL, 
// DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES, EVEN IF AUTODESK 
// AND/OR ITS LICENSORS HAS BEEN ADVISED OF THE POSSIBILITY 
// OR PROBABILITY OF SUCH DAMAGES.
//
// ==========================================================================
//+
//

#ifndef DDS_FLOAT_READER_H
#define DDS_FLOAT_READER_H

#define DEBUG_DDS( x) 
//#define DEBUG_DDS( x) x

#ifdef _WIN32
#pragma pack(1)
#endif

#ifndef _WIN32
typedef unsigned char BYTE;
typedef unsigned int DWORD;
typedef unsigned short WORD;
#endif

namespace dds_Float_Reader
{
// 
// Our DDS constants
//

#define DDS_MAGIC_NUMBER				0x20534444

#define DDS_CAPS_FLAG					0x00000001
#define DDS_HEIGHT_FLAG					0x00000002
#define DDS_WIDTH_FLAG					0x00000004
#define DDS_PITCH_FLAG					0x00000008
#define DDS_PIXEL_FORMAT_FLAG			0x00001000
#define DDS_MIPMAP_COUNT_FLAG			0x00020000
#define DDS_LINEARSIZE_FLAG				0x00080000
#define DDS_DEPTH_FLAG					0x00800000
#define DDS_HAS_ALPHA_FLAG				0x00000001
#define DDS_FOURCC_FLAG					0x00000004
#define DDS_RGB_FLAG					0x00000040
#define DDS_PALETTEINDEXED8				0x00000020			
#define DDS_PALETTEINDEXED4TO8			0x00000010
#define DDS_PALETTEINDEXED4				0x00000008

#define DDSCAPS_COMPLEX_FLAG			0x00000008
#define DDSCAPS_TEXTURE_FLAG			0x00001000
#define DDSCAPS_MIPMAP_FLAG				0x00400000

#define DDSCAPS2_CUBEMAP_FLAG			0x00000200
#define DDSCAPS2_CUBEMAP_POSITIVEX_FLAG	0x00000400
#define DDSCAPS2_CUBEMAP_NEGATIVEX_FLAG	0x00000800
#define DDSCAPS2_CUBEMAP_POSITIVEY_FLAG	0x00001000
#define DDSCAPS2_CUBEMAP_NEGATIVEY_FLAG	0x00002000
#define DDSCAPS2_CUBEMAP_POSITIVEZ_FLAG	0x00004000
#define DDSCAPS2_CUBEMAP_NEGATIVEZ_FLAG	0x00008000

#define DDSCAPS2_VOLUME_FLAG			0x00200000

#define DDS_DXT1						0x31545844
#define DDS_DXT2						0x32545844
#define DDS_DXT3						0x33545844
#define DDS_DXT4						0x34545844
#define DDS_DXT5						0x35545844


// Float and half float formats specified in FourCC
#define DDS_R16F						111
#define DDS_G16R16F						112
#define DDS_A16B16G16R16F				113
#define DDS_R32F						114
#define DDS_G32R32F						115
#define DDS_A32B32G32R32F				116

//
// This structure describes the format of the file's pixel data 
//
typedef struct DDS_FORMAT {
	DWORD		fSize;
	DWORD		fFlags;
	DWORD		fPixelFormat; //fFourCC;
	DWORD		fRGBBitCount;
	DWORD		fRedBitMask;
	DWORD		fGreenBitMask;
	DWORD		fBlueBitMask;
	DWORD		fAlphaBitMask;
} DDS_FORMAT;


//
// DDS capabilities structure
//
typedef struct DDSCAPS2 {
    DWORD       dwCaps;         // capabilities of surface wanted
    DWORD       dwCaps2;
    DWORD       dwCaps3;
    union
    {
        DWORD       dwCaps4;
        DWORD       dwVolumeDepth;
    };
} DDSCAPS2;


//
// The header for a DDS file
//
typedef struct DDS_HEADER {
	DWORD		fDDSMagicNumber;
	DWORD		fSize;
	DWORD		fFlags;
	DWORD		fHeight;
	DWORD		fWidth;
	union {
		DWORD		fUncompressedPitch;
		DWORD		fCompressedSize;
	};
	DWORD		fDepth;
	DWORD		fMipMapCount;
	DWORD		fReserved1[11];
	DDS_FORMAT	fFormat;			// Pixel format 
	DDSCAPS2	fCapabilities;
	DWORD		fReserved2;
} DDS_HEADER;

}

#ifdef _WIN32
#pragma pack()
#endif /*WIN32*/

#endif 
